package org.bigk.invoices.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.bigk.invoices.utils.TextUtils;

@Entity
@Table(name = "purchasers")
public class Purchaser extends PaginatedBean implements Serializable {

	private static final long serialVersionUID = 1548460555302521767L;
	

	@Id
	@GeneratedValue
	@Column(name = "id")
	private Long id;

	@Column(name = "name")
	private String name;

	@Column(name = "address")
	private String address;

	@Column(name = "nip")
	private String nip;

	public Purchaser() {
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getNip() {
		return nip;
	}

	public void setNip(String nip) {
		this.nip = nip;
	}
	
	public String getNameHTML() {
		return TextUtils.convert2HtmlText(name);
	}

	public String getAddressHTML() {
		return TextUtils.convert2HtmlText(address);
	}

	public String getNameJS() {
		return TextUtils.convert2JsText(name);
	}

	public String getAddressJS() {
		return TextUtils.convert2JsText(address);
	}

	public String getNipJS() {
		return TextUtils.convert2JsText(nip);
	}

}
